package interpreter;

import heap.Heap;

import java.lang.reflect.Method;
import java.util.Collection;

public class HeapAnalyzeInst implements Instruction {


	@Override
	public void execute() {
		try {
			
			Class<?> npjClass = Class.forName("NPJ");			
			Object npj = npjClass.newInstance();			
			Method heapAnalyzeMethod = npjClass.getMethod("heapAnalyze", new Class[] { Collection.class, Collection.class });			
			Heap heap = Heap.getInstance();			
			heapAnalyzeMethod.invoke(npj, heap.collectT(), heap.collectS());
			
			
		} catch(Exception ex) {
			ex.printStackTrace();
		}
	}

}
